package com.yikaiye.android.yikaiye.ui.fragment;

import android.text.Html;

import com.yikaiye.android.yikaiye.base.BaseFragment;
import com.yikaiye.android.yikaiye.base.BaseViewModel;
import com.yikaiye.android.yikaiye.databinding.FragmentServiceDescriptionBinding;
import com.yikaiye.android.yikaiye.widget.AutoHeightViewPager;

/**
 * 服务说明
 */
public class ServiceDescriptionFragment extends BaseFragment<FragmentServiceDescriptionBinding, BaseViewModel> {

    private final AutoHeightViewPager viewPager;
    private final String instruction;

    @Override
    protected BaseViewModel bindModel() {
        return getViewModel(this, BaseViewModel.class);
    }

    @Override
    protected void initInject() {
        getFragmentComponent().inject(this);
    }

    @Override
    protected void initData() {
        viewPager.setObjectForPosition(binding.getRoot(), 1);//0代表tab的位置
        binding.desTv.setText(Html.fromHtml(instruction, Html.FROM_HTML_MODE_LEGACY));

    }

    public ServiceDescriptionFragment(AutoHeightViewPager viewPager, String instruction) {
        this.viewPager = viewPager;
        this.instruction = instruction;
    }

    public static ServiceDescriptionFragment newInstance(AutoHeightViewPager viewPager, String instruction) {
        return new ServiceDescriptionFragment(viewPager, instruction);
    }
}
